libError
	parent_type = /libBase
	name = "libError"
	numVerP = 0
	numVerM = 0
	numVerR = 0

	var
		tblError = "core_Error"

	proc
		catchError(errorstring)
			//type, source, arguments, debug
			var/list/a = params2list(errorstring)
			createErrorTable()
			Core.DB.insertData("tbl=[tblError];type=\"[a["type"]]\";source=\"[a["source"]]\";location=\"[a["location"]]\";errorInf=\"[a["error"]]\";debugInf=\"[a["debug"]]\";errorDate=\"[time2text(world.realtime,"YYYY-MM-DD hh:mm:ss")]\"")

		createErrorTable()

			if(!Core.DB.DBCon.IsConnected()) Core.DB.establishConnection()

			if(existsErrorTable()) return FALSE

			var/sql = {"
			CREATE TABLE `[Core.DB.getDB()]`.`[getErrorTable()]` (
				errorID		INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
				type		VARCHAR(50),
				source		VARCHAR(255),
				location	VARCHAR(255),
				errorInf	VARCHAR(2000),
				debugInf	VARCHAR(2000),
				errorDate	DATETIME NOT NULL,
				PRIMARY KEY	(`errorID`)
				) ENGINE=InnoDB;
			"}

			Core.DB.runQuery(sql)

			return existsErrorTable()

		existsErrorTable()
			var/DBQuery/q = Core.DB.Query("Describe [getErrorTable()]")
			return q.Execute()

		setErrorTable(tbl as text)
			tblError = tbl

		getErrorTable()
			return tblError